package Evaluation;

import weka.core.*;
import java.util.*;

public class Main {
	
	public static void main(String args[]){
		/*get the file to be clustered*/
		String s = SysConfig.getInstance().getStringValue("fileToBeClustered");
		Cluster c = new Cluster(s, 3, 500);
		/*get the cluster result*/
		Instances result = c.cluster();
		
		AttributeMap am = new AttributeMap();
		am.constructMap(result);
		/*clusterAttIndex is the cluster attribute`s index*/
		int clusterAttIndex = am.getClusterAttIndex();
		System.out.println(clusterAttIndex);
		ClusterResultMap crm = new ClusterResultMap(clusterAttIndex);
		/*get the map of clusters and test cases m*/
		Map<Integer, ArrayList<Integer>> m = crm.clusterResultMap(result);
		for(int i: m.keySet()){
			System.out.print("cluseter" + i + ": ");
			for(int j: m.get(i))
				System.out.print(j + " ");
			System.out.println();
		}
		
		TestCaseDivide tcd = new TestCaseDivide();
		tcd.divideFailureSucess("v2.txt");
		
		FailurePurity fp = new FailurePurity(crm, tcd);
		System.out.println(fp.calculateFP());
		
	}

	
}
